package version1;

public class Account {
	private int balance;
	private int avaliableBalance;
	private int accountNumber;
	@SuppressWarnings("unused")
	private String client;
	private int pin;

	public Account(int n, int b, String c, int pin) {
		avaliableBalance = balance = b;
		accountNumber = n;
		client = c;
		this.pin = pin;
	}

	public int GetAccountNumber() {
		return accountNumber;
	}

	public int GetAvailableBalance() {
		return avaliableBalance;
	}

	public int GetTotalBalance() {
		return balance;
	}

	public boolean Debit(int valor) {
		if (avaliableBalance >= valor) {
			avaliableBalance = avaliableBalance - valor;
			balance = balance - valor;
			return true;
		}
		return false;
	}

	public void credit(int valor) {
		avaliableBalance = balance;
		balance = balance + valor;
	}

	public void updateState() {
		avaliableBalance = balance;
	}

	public boolean checkPIN(int p) {
		return pin == p;
	}

}